import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '标题',
    align:"center",
    dataIndex: 'biaot'
   },
   {
    title: '说明',
    align:"center",
    dataIndex: 'shuom'
   },
   {
    title: '宣言',
    align:"center",
    dataIndex: 'xuany'
   },
   {
    title: '参赛对象',
    align:"center",
    dataIndex: 'cansdx',
    customRender:({text}) => {
       return  render.renderCategoryTree(text,'C03')
   },
   },
   {
    title: '作品归属',
    align:"center",
    dataIndex: 'zuopgs',
    customRender:({text}) => {
       return  render.renderCategoryTree(text,'C04')
   },
   },
   {
    title: '设计图纸',
    align:"center",
    dataIndex: 'shejtz',
    customRender:render.renderImage,
   },
   {
    title: '亮灯全景',
    align:"center",
    dataIndex: 'liangdqj',
    customRender:render.renderImage,
   },
   {
    title: '亮灯局部',
    align:"center",
    dataIndex: 'liangdjb',
    customRender:render.renderImage,
   },
   {
    title: '赛区',
    align:"center",
    dataIndex: 'saiq_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'biaot',
    component: 'Input',
  },
  {
    label: '说明',
    field: 'shuom',
    component: 'InputTextArea',
  },
  {
    label: '宣言',
    field: 'xuany',
    component: 'InputTextArea',
  },
  {
    label: '参赛对象',
    field: 'cansdx',
    component: 'JCategorySelect',
    componentProps:{
       pcode:"C03", //TODO back和事件未添加，暂时有问题
    },
  },
  {
    label: '作品归属',
    field: 'zuopgs',
    component: 'JCategorySelect',
    componentProps:{
       pcode:"C04", //TODO back和事件未添加，暂时有问题
    },
  },
  {
    label: '设计图纸',
    field: 'shejtz',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '亮灯全景',
    field: 'liangdqj',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '亮灯局部',
    field: 'liangdjb',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '赛区',
    field: 'saiq',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"saiq"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  biaot: {title: '标题',order: 0,view: 'text', type: 'string',},
  shuom: {title: '说明',order: 1,view: 'textarea', type: 'string',},
  xuany: {title: '宣言',order: 2,view: 'textarea', type: 'string',},
  cansdx: {title: '参赛对象',order: 3,view: 'cat_tree', type: 'string',pcode: 'C03',},
  zuopgs: {title: '作品归属',order: 4,view: 'cat_tree', type: 'string',pcode: 'C04',},
  shejtz: {title: '设计图纸',order: 5,view: 'image', type: 'string',},
  liangdqj: {title: '亮灯全景',order: 6,view: 'image', type: 'string',},
  liangdjb: {title: '亮灯局部',order: 7,view: 'image', type: 'string',},
  saiq: {title: '赛区',order: 8,view: 'list', type: 'string',dictCode: 'saiq',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}